<div class="content-wrapper">

    <section class="content-header">
        <?php echo $this->partial('layout/breadcrumb'); ?>
        <h1 class="pull-right">
            <a href="<?php echo $this->url('goods-tag', ['action'=> 'add']);?>" class="btn btn-primary btn-sm"><i class="fa fa-plus"></i> <?php echo $this->translate('添加标签'); ?></a>
            <?php echo $this->HelpUrl('goodsTag'); ?>
        </h1>
    </section>

    <section class="content">
        <?php echo $this->partial('layout/messages'); ?>

        <div class="row">
            <div class="col-xs-12">
                <form method="post" action="<?php echo $this->url('goods-tag', ['action' => 'updateAllSort']);?>" name="edit-all-form" id="edit-all-form">
                <div class="box shop-box">
                    <div class="box-body table-responsive no-padding">
                        <table class="table shop-table table-hover">
                            <thead>
                            <tr class="shop-bg-thead">
                                <th width="20%"><?php echo $this->translate('标签名称'); ?></th>
                                <th width="10%"><?php echo $this->translate('标签组'); ?></th>
                                <th width="10%"><?php echo $this->translate('商品数量'); ?></th>
                                <th width="5%"><?php echo $this->translate('排序'); ?></th>
                                <th width="8%"><?php echo $this->translate('操作'); ?></th>
                            </tr>
                            </thead>
                            <tbody>
                            <?php if($this->tagList) foreach ($this->tagList as $value) { ?>
                                <tr>
                                    <td>
                                        <?php echo $this->escapeHtml($value[0]->getTagName()); ?>
                                        <?php if($value[0]->getTagStr()) { ?>
                                            <label style="background-color: <?php echo $this->escapeHtml($value[0]->getTagStr()); ?>;height: 14px;width: 14px;border: 1px solid #E4E4E4;display:inline-block;line-height: 20px;vertical-align: middle;"></label>
                                        <?php } ?>
                                    </td>
                                    <td><?php echo $this->escapeHtml($value[0]->getOneTagGroup()->getTagGroupName()).(!empty($value[0]->getOneTagGroup()->getTagGroupMark()) ? '&nbsp;['.$this->escapeHtml($value[0]->getOneTagGroup()->getTagGroupMark()).']' : ''); ?></td>
                                    <td><?php echo $value['goodsNum']; ?></td>
                                    <td><input type="number" name="tagSort[<?php echo $value[0]->getTagId(); ?>]" value="<?php echo $this->escapeHtml($value[0]->getTagSort()); ?>" class="form-control input-sm"></td>
                                    <td>
                                        <a href="<?php echo $this->url('goods-tag',
                                            ['action'=>'edit', 'id'=>$value[0]->getTagId()]); ?>"
                                           class="btn btn-xs btn-success"><i class="fa fa-pencil"></i> <?php echo $this->translate('编辑'); ?></a>

                                        <a href="javascript:;" onclick="deleteConfirm('<?php echo $this->translate('您确实要删除该标签吗?'); ?>', '<?php echo $this->url('goods-tag', ['action'=>'delete', 'id'=>$value[0]->getTagId()], ['query' => ['qToken' => $this->adminHelper()->getCsrfValue()]]); ?>');" class="btn btn-xs btn-danger"><i class="fa fa-trash"></i> <?php echo $this->translate('删除'); ?></a>
                                    </td>
                                </tr>
                            <?php } ?>
                            </tbody>
                        </table>
                    </div>
                    <div class="box-footer clearfix">
                        <button type="submit" class="btn btn-primary btn-sm"><i class="fa fa-check"></i> <?php echo $this->translate('更新'); ?></button>
                    </div>
                </div>
                </form>
            </div>
        </div>

    </section>
</div>